<template>
    <div class="page-container">
        <p>姓名：<span>{{user.realName}}</span></p>
        <p>手机号：<span>{{user.phone}}</span></p>
        <p>所在城市：<span>{{user.city}}</span></p>
        <p>帐户类型：{{user.id == 1 ? '超级管理员' : '城市管理员'}}</p>
    </div>
</template>
<script>
import * as Login from '@/api/login'
import * as District from '@/api/district'

export default {
  data() {
    return {
      user: {}
    }
  },
  mounted() {
    this.getProfile()
  },
  methods: {
    getProfile() {
      Login.getInfo().then(data => {
        District.getDistrictName(data.cityId).then(n => this.$set(this.user, 'city', n))
        this.user = data
      }).catch(err => this.$message.error(err.message || err))
    }
  }
}
</script>
